class Comment:
    def __init__(self, detail, view_times):
        self.detail = detail
        self.view_times = view_times

    def info():
        print("一条简单的评论，内容：%s" % self.detail)


c = Comment("comment is good", 20)
print(hasattr(c, 'detail'))
print(hasattr(c, 'info'))
print(getattr(c, 'info', '默认值'))
setattr(c, 'detail', '天气不错')
print(c.detail)
setattr(c, 'test', 'new add method')
print(c.test)


def bar():
    print("this is a easy method")


setattr(c, 'info', bar)
c.info()

setattr(c, 'info', 'sss')
print(c.info)
